<?php
/**
 * Copyright (c) 2006, PORTALIER Julien
 *
 * Licensed under The LGPL License
 * Redistributions of files must retain the above copyright notice.
 *
 * @package      Feather's website
 * @copyright    Copyright (c) 2006, Julien PORTALIER
 * @link         http://feather.portalier.com
 * @license      http://www.opensource.org/licenses/lgpl-license.php The LGPL License
 */

class ModuleTagsController extends Controller
{
	public $_templates = 'tags';
	public $moduleClass;
	
	function cloud($module_id)
	{
		$model   = $this->{$this->modelClass};
		$referer = $model->{$this->refererClass};
		$module  = $referer->{$this->moduleClass};
		
		$model->join($module, $referer);
		$model->conditions(array("{$module->name}.{$module->primaryKey}" => $module_id));
		
		$this->data = $model->getCloud();
	}
	
	// admin
	
	function administer($module_id)
	{
		$model   = $this->{$this->modelClass};
		$module  = $model->{$this->refererClass}->{$this->moduleClass};
		
		$model->conditions(array("{$this->refererClass}.{$module->foreignKey}" => $module_id));
		parent::administer();
	}
	
	function rename($module_id)
	{
		// @todo ModuleTagsController::erase()
		$this->flash(_('Error: this function has yet to be implemented.'), getReferer());
	}
	
	function erase($module_id, $tag)
	{
		// @todo ModuleTagsController::erase()
		$this->flash(_('Error: this function has yet to be implemented.'), getReferer());
	}
}
?>